<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>知猿社区</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/nodeModules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="/nodeModules/bootstrap/dist/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/nodeModules/css/community.css">
    <link rel="stylesheet" href="/nodeModules/editor.md/css/editormd.preview.min.css">
    <script type="text/javascript" src="/nodeModules/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="/nodeModules/bootstrap/dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/nodeModules/moment/moment.js"></script>
    <script type="text/javascript" src="/nodeModules/js/community.js"></script>
    <script type="text/javascript" src="/nodeModules/editor.md/editormd.min.js"></script>
    <script type="text/javascript" src="/nodeModules/editor.md/lib/marked.min.js"></script>
    <script type="text/javascript" src="/nodeModules/editor.md/lib/prettify.min.js"></script>
    <script type="application/javascript">
        window.onload = function () {
            var closable = window.localStorage.getItem("closable");
            if (closable == "true") {
                window.close();
                window.localStorage.removeItem("closable");
            }

        }
    </script>
</head>
<body>
<!--顶部-->
<div th:insert="~{navigation :: nav}"></div>
<!--内容-->
<div class="container main">
    <div class="row">
        <!--左边布局 帖子列表-->
        <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12" style="border-right:1px solid #DDDDDD;">
            <ul class="nav  nav-tabs active" role="tablist">

                <li role="presentation" class="nav-tabs-li"
                    th:classappend="${sort == 'no' ? 'active':''}">
                    <a th:href="@{/(sort='no')}" style="color: #E51C37">消灭零回复</a></li>

                <li role="presentation" class="nav-tabs-li"
                    th:classappend="${sort == 'hot' ? 'active ':''}">
                    <a th:href="@{/(sort='hot')}">最热</a></li>

                <li role="presentation" class="nav-tabs-li"
                    th:classappend="${sort == 'hot7' ? 'active':''}">
                    <a th:href="@{/(sort='hot7')}">7天最热</a></li>

                <li role="presentation" class="nav-tabs-li"
                    th:classappend="${sort == 'hot30' ? 'active':''}">
                    <a th:href="@{/(sort='hot30')}">30天最热</a></li>

                <li role="presentation" class="nav-tabs-li"
                    th:classappend="${sort == 'new' || sort == null ? 'active ':''}">
                    <a th:href="@{/(sort='new')}">最新</a></li>

                <h2 class="nav-tabs-h2">
                    <i class="glyphicon glyphicon-list"></i>
                    发现
                </h2>
            </ul>
            <!--列表-->
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active index-tablist" id="indexHome">
                    <div class="media" th:each="question : ${pagination.data}">
                        <div class="media-left">
                            <a href="#">
                                <img th:src="${question.user.avatarUrl}"
                                     class="media-object img-rounded">
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading index-title">
                                <a th:href="@{'/question/'+${question.id}}" th:text="${question.title}"></a>
                            </h4>
                            <span th:text="${question.description}" class="index-title-description"></span>
                            <br>
                            <span class="text-desc index-state">
                                <span th:text="${question.tag}" class="index-questionTag"></span> •
                                <span th:text="${question.user.name}" th:if="${question.user.name!=null}"
                                      style="color: #666666"></span>
                                <span th:if="${question.user.name==null}" style="color: #666666">匿名用户 </span>•&nbsp;
                                <span class="glyphicon glyphicon-comment"></span>
                                <span th:text="${question.commentCount}"></span>条回复 •&nbsp;
                                <span class="glyphicon glyphicon-eye-open"></span>
                                <span th:text="${question.viewCount}"></span>个浏览 •&nbsp;
                                <span th:text="${#dates.format(question.gmtCreate,'yyyy-MM-dd HH:mm')}"></span></span>
                        </div>
                        <hr>
                    </div>
                    <!--最新-页数-->
                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            <li th:if="${pagination.showFirstPage}">
                                <a th:href="@{/(page=1,search=${search},tag=${tag},sort=${sort})}"
                                   aria-label="Previous">
                                    <span aria-hidden="true">&lt;&lt;</span>
                                </a>
                            </li>
                            <li th:if="${pagination.showPrevious}">
                                <a th:href="@{/(page=${pagination.page - 1},search=${search},tag=${tag},sort=${sort})}"
                                   aria-label="Previous">
                                    <span aria-hidden="true">&lt;</span>
                                </a>
                            </li>

                            <li th:each="page : ${pagination.pages}"
                                th:class="${pagination.page == page}? 'active' : ''">
                                <a th:href="@{/(page=${page},search=${search},tag=${tag},sort=${sort})}"
                                   th:text="${page}"></a>
                            </li>

                            <li th:if="${pagination.showNext}">
                                <a th:href="@{/(page=${pagination.page +1 },search=${search},tag=${tag},sort=${sort})}"
                                   aria-label="Previous">
                                    <span aria-hidden="true">&gt;</span>
                                </a>
                            </li>
                            <li th:if="${pagination.showEndPage}">
                                <a th:href="@{/(page=${pagination.totalPage},search=${search},tag=${tag},sort=${sort})}"
                                   aria-label="Previous">
                                    <span aria-hidden="true">&gt;&gt;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>
                </div>
            </div>

        </div>
        <!--右边布局 热门话题-->
        <div class="col-lg-3 col-md-3 hidden-xs hidden-sm index-leftPlace">
            <!--扫码-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 media index-aside-code">
                <div class="media-left text-left">
                    <img src="/images/wechat.png" class="media-object question-code img-thumbnail">
                </div>
                <a class="media-body text-center" id="index-code" data-toggle="popover" data-placement="bottom">
                    <h4 class="media-heading">扫码知猿手机网页 ></h4>
                    <div>随时随地发现和解决问题</div>
                </a>
            </div>
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <h4>热门标签</h4>
                <a th:each="tag : ${tags}" th:href="@{/(page=1,search=${search},tag=${tag},sort=${sort})}"
                   th:text="${tag}" class="community-tag"></a>
            </div>
        </div>
    </div>
</div>
<!--底部-->
<div th:insert="~{footer :: foot}"></div>
</body>

</html>